.class public Lcom/netease/newsreader/util/DragableListView;
.super Landroid/widget/ListView;
.source "DragableListView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/DragableListView$DropListener;
    }
.end annotation


# instance fields
.field public dragMaxX:I

.field public dragMinX:I

.field private dragndropBackgroundColor:I

.field private mCoordOffset:I

.field private mDragBitmap:Landroid/graphics/Bitmap;

.field private mDragPoint:I

.field private mDragPos:I

.field private mDragView:Landroid/widget/ImageView;

.field private mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

.field private mFirstDragPos:I

.field private mHeight:I

.field private mItemHeightExpanded:I

.field private mItemHeightHalf:I

.field private mItemHeightNormal:I

.field private mLowerBound:I

.field private mTempRect:Landroid/graphics/Rect;

.field private final mTouchSlop:I

.field private mUpperBound:I

.field private mWindowManager:Landroid/view/WindowManager;

.field private mWindowParams:Landroid/view/WindowManager$LayoutParams;

.field private myItemNum:I

.field private xValue:I

.field private yValue:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 50
    const/4 v0, 0x0

    invoke-direct {p0, p1, p2, v0}, Lcom/netease/newsreader/util/DragableListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 52
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 3
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    const/4 v2, 0x0

    const/4 v1, -0x1

    .line 55
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/ListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 32
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/netease/newsreader/util/DragableListView;->mTempRect:Landroid/graphics/Rect;

    .line 39
    const v0, -0x3f3f40

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->dragndropBackgroundColor:I

    .line 41
    const/16 v0, 0x20

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightHalf:I

    .line 42
    const/16 v0, 0x40

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightNormal:I

    .line 43
    const/16 v0, 0x80

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightExpanded:I

    .line 45
    iput v2, p0, Lcom/netease/newsreader/util/DragableListView;->dragMinX:I

    .line 46
    iput v2, p0, Lcom/netease/newsreader/util/DragableListView;->dragMaxX:I

    .line 47
    iput v1, p0, Lcom/netease/newsreader/util/DragableListView;->myItemNum:I

    .line 60
    iput v1, p0, Lcom/netease/newsreader/util/DragableListView;->yValue:I

    .line 61
    iput v1, p0, Lcom/netease/newsreader/util/DragableListView;->xValue:I

    .line 57
    invoke-static {p1}, Landroid/view/ViewConfiguration;->get(Landroid/content/Context;)Landroid/view/ViewConfiguration;

    move-result-object v0

    invoke-virtual {v0}, Landroid/view/ViewConfiguration;->getScaledTouchSlop()I

    move-result v0

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mTouchSlop:I

    .line 58
    return-void
.end method

.method private adjustScrollBounds(I)V
    .locals 1
    .parameter "y"

    .prologue
    .line 271
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    div-int/lit8 v0, v0, 0x3

    if-lt p1, v0, :cond_0

    .line 272
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    div-int/lit8 v0, v0, 0x3

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mUpperBound:I

    .line 274
    :cond_0
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    mul-int/lit8 v0, v0, 0x2

    div-int/lit8 v0, v0, 0x3

    if-gt p1, v0, :cond_1

    .line 275
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    mul-int/lit8 v0, v0, 0x2

    div-int/lit8 v0, v0, 0x3

    iput v0, p0, Lcom/netease/newsreader/util/DragableListView;->mLowerBound:I

    .line 277
    :cond_1
    return-void
.end method

.method private doExpansion()V
    .locals 9

    .prologue
    .line 317
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v8

    sub-int v0, v7, v8

    .line 318
    .local v0, childnum:I
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    iget v8, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    if-le v7, v8, :cond_0

    .line 319
    add-int/lit8 v0, v0, 0x1

    .line 322
    :cond_0
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v8

    sub-int/2addr v7, v8

    invoke-virtual {p0, v7}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    .line 324
    .local v1, first:Landroid/view/View;
    const/4 v3, 0x0

    .line 325
    .local v3, i:I
    :goto_0
    invoke-virtual {p0, v3}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v6

    .line 326
    .local v6, vv:Landroid/view/View;
    if-nez v6, :cond_1

    .line 350
    return-void

    .line 329
    :cond_1
    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightNormal:I

    .line 330
    .local v2, height:I
    const/4 v5, 0x0

    .line 331
    .local v5, visibility:I
    invoke-virtual {v6, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_4

    .line 333
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    iget v8, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    if-ne v7, v8, :cond_3

    .line 335
    const/4 v5, 0x4

    .line 345
    :cond_2
    :goto_1
    invoke-virtual {v6}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v4

    .line 346
    .local v4, params:Landroid/view/ViewGroup$LayoutParams;
    iput v2, v4, Landroid/view/ViewGroup$LayoutParams;->height:I

    .line 347
    invoke-virtual {v6, v4}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 348
    invoke-virtual {v6, v5}, Landroid/view/View;->setVisibility(I)V

    .line 324
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 338
    .end local v4           #params:Landroid/view/ViewGroup$LayoutParams;
    :cond_3
    const/4 v2, 0x1

    goto :goto_1

    .line 340
    :cond_4
    if-ne v3, v0, :cond_2

    .line 341
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getCount()I

    move-result v8

    add-int/lit8 v8, v8, -0x1

    if-ge v7, v8, :cond_2

    .line 342
    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightExpanded:I

    goto :goto_1
.end method

.method private dragView(II)V
    .locals 4
    .parameter "x"
    .parameter "y"

    .prologue
    .line 250
    const/high16 v0, 0x3f00

    .line 251
    .local v0, alpha:F
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iput v0, v1, Landroid/view/WindowManager$LayoutParams;->alpha:F

    .line 253
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPoint:I

    sub-int v2, p2, v2

    iget v3, p0, Lcom/netease/newsreader/util/DragableListView;->mCoordOffset:I

    add-int/2addr v2, v3

    iput v2, v1, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 254
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowManager:Landroid/view/WindowManager;

    iget-object v2, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    iget-object v3, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    invoke-interface {v1, v2, v3}, Landroid/view/WindowManager;->updateViewLayout(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 255
    return-void
.end method

.method private startDragging(Landroid/graphics/Bitmap;I)V
    .locals 6
    .parameter "bm"
    .parameter "y"

    .prologue
    const/4 v5, 0x0

    const/4 v4, -0x2

    .line 206
    invoke-direct {p0}, Lcom/netease/newsreader/util/DragableListView;->stopDragging()V

    .line 208
    new-instance v1, Landroid/view/WindowManager$LayoutParams;

    invoke-direct {v1}, Landroid/view/WindowManager$LayoutParams;-><init>()V

    iput-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    .line 209
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    const/16 v2, 0x30

    iput v2, v1, Landroid/view/WindowManager$LayoutParams;->gravity:I

    .line 210
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iput v5, v1, Landroid/view/WindowManager$LayoutParams;->x:I

    .line 211
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPoint:I

    sub-int v2, p2, v2

    iget v3, p0, Lcom/netease/newsreader/util/DragableListView;->mCoordOffset:I

    add-int/2addr v2, v3

    iput v2, v1, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 213
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iput v4, v1, Landroid/view/WindowManager$LayoutParams;->height:I

    .line 214
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iput v4, v1, Landroid/view/WindowManager$LayoutParams;->width:I

    .line 215
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    const/16 v2, 0x198

    iput v2, v1, Landroid/view/WindowManager$LayoutParams;->flags:I

    .line 219
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    const/4 v2, -0x3

    iput v2, v1, Landroid/view/WindowManager$LayoutParams;->format:I

    .line 220
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    iput v5, v1, Landroid/view/WindowManager$LayoutParams;->windowAnimations:I

    .line 222
    new-instance v0, Landroid/widget/ImageView;

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 225
    .local v0, v:Landroid/widget/ImageView;
    iget v1, p0, Lcom/netease/newsreader/util/DragableListView;->dragndropBackgroundColor:I

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setBackgroundColor(I)V

    .line 226
    invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    .line 227
    iput-object p1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragBitmap:Landroid/graphics/Bitmap;

    .line 229
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getContext()Landroid/content/Context;

    move-result-object v1

    .line 230
    const-string v2, "window"

    invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/view/WindowManager;

    .line 229
    iput-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowManager:Landroid/view/WindowManager;

    .line 231
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowManager:Landroid/view/WindowManager;

    iget-object v2, p0, Lcom/netease/newsreader/util/DragableListView;->mWindowParams:Landroid/view/WindowManager$LayoutParams;

    invoke-interface {v1, v0, v2}, Landroid/view/WindowManager;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 232
    iput-object v0, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    .line 233
    return-void
.end method

.method private stopDragging()V
    .locals 4

    .prologue
    const/4 v3, 0x0

    .line 236
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    if-eqz v1, :cond_0

    .line 237
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getContext()Landroid/content/Context;

    move-result-object v1

    .line 238
    const-string v2, "window"

    .line 237
    invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/WindowManager;

    .line 239
    .local v0, wm:Landroid/view/WindowManager;
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    invoke-interface {v0, v1}, Landroid/view/WindowManager;->removeView(Landroid/view/View;)V

    .line 240
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    invoke-virtual {v1, v3}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 241
    iput-object v3, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    .line 243
    .end local v0           #wm:Landroid/view/WindowManager;
    :cond_0
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragBitmap:Landroid/graphics/Bitmap;

    if-eqz v1, :cond_1

    .line 244
    iget-object v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragBitmap:Landroid/graphics/Bitmap;

    invoke-virtual {v1}, Landroid/graphics/Bitmap;->recycle()V

    .line 245
    iput-object v3, p0, Lcom/netease/newsreader/util/DragableListView;->mDragBitmap:Landroid/graphics/Bitmap;

    .line 247
    :cond_1
    return-void
.end method

.method private unExpandViews(Z)V
    .locals 7
    .parameter "deletion"

    .prologue
    const/4 v6, 0x0

    .line 283
    const/4 v0, 0x0

    .line 284
    .local v0, i:I
    :goto_0
    invoke-virtual {p0, v0}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    .line 285
    .local v3, v:Landroid/view/View;
    if-nez v3, :cond_1

    .line 286
    if-eqz p1, :cond_0

    .line 288
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v2

    .line 289
    .local v2, position:I
    invoke-virtual {p0, v6}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v5

    invoke-virtual {v5}, Landroid/view/View;->getTop()I

    move-result v4

    .line 290
    .local v4, y:I
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getAdapter()Landroid/widget/ListAdapter;

    move-result-object v5

    invoke-virtual {p0, v5}, Lcom/netease/newsreader/util/DragableListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 291
    invoke-virtual {p0, v2, v4}, Lcom/netease/newsreader/util/DragableListView;->setSelectionFromTop(II)V

    .line 294
    .end local v2           #position:I
    .end local v4           #y:I
    :cond_0
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->layoutChildren()V

    .line 295
    invoke-virtual {p0, v0}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    .line 296
    if-nez v3, :cond_1

    .line 305
    return-void

    .line 300
    :cond_1
    invoke-virtual {v3}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v1

    .line 301
    .local v1, params:Landroid/view/ViewGroup$LayoutParams;
    iget v5, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightNormal:I

    iput v5, v1, Landroid/view/ViewGroup$LayoutParams;->height:I

    .line 302
    invoke-virtual {v3, v1}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 303
    invoke-virtual {v3, v6}, Landroid/view/View;->setVisibility(I)V

    .line 283
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method


# virtual methods
.method public getItemForPosition(I)I
    .locals 4
    .parameter "y"

    .prologue
    .line 258
    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPoint:I

    sub-int v2, p1, v2

    iget v3, p0, Lcom/netease/newsreader/util/DragableListView;->mItemHeightHalf:I

    sub-int v0, v2, v3

    .line 259
    .local v0, adjustedy:I
    const/4 v2, 0x0

    invoke-virtual {p0, v2, v0}, Lcom/netease/newsreader/util/DragableListView;->myPointToPosition(II)I

    move-result v1

    .line 260
    .local v1, pos:I
    if-ltz v1, :cond_1

    .line 261
    iget v2, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    if-gt v1, v2, :cond_0

    .line 262
    add-int/lit8 v1, v1, 0x1

    .line 267
    :cond_0
    :goto_0
    return v1

    .line 264
    :cond_1
    if-gez v0, :cond_0

    .line 265
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public getMyItemNum()I
    .locals 1

    .prologue
    .line 381
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->myItemNum:I

    return v0
.end method

.method public getXValue()I
    .locals 1

    .prologue
    .line 66
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->xValue:I

    return v0
.end method

.method public getYValue()I
    .locals 1

    .prologue
    .line 63
    iget v0, p0, Lcom/netease/newsreader/util/DragableListView;->yValue:I

    return v0
.end method

.method public myPointToPosition(II)I
    .locals 5
    .parameter "x"
    .parameter "y"

    .prologue
    .line 357
    iget-object v2, p0, Lcom/netease/newsreader/util/DragableListView;->mTempRect:Landroid/graphics/Rect;

    .line 358
    .local v2, frame:Landroid/graphics/Rect;
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getChildCount()I

    move-result v1

    .line 359
    .local v1, count:I
    add-int/lit8 v3, v1, -0x1

    .local v3, i:I
    :goto_0
    if-gez v3, :cond_0

    .line 368
    const/4 v4, -0x1

    :goto_1
    return v4

    .line 360
    :cond_0
    invoke-virtual {p0, v3}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    .line 361
    .local v0, child:Landroid/view/View;
    invoke-virtual {v0, v2}, Landroid/view/View;->getHitRect(Landroid/graphics/Rect;)V

    .line 362
    invoke-virtual {v2, p1, p2}, Landroid/graphics/Rect;->contains(II)Z

    move-result v4

    if-eqz v4, :cond_2

    .line 364
    invoke-virtual {v2}, Landroid/graphics/Rect;->centerY()I

    move-result v4

    if-le v4, p2, :cond_1

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v4

    add-int/2addr v4, v3

    goto :goto_1

    .line 365
    :cond_1
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v4

    add-int/2addr v4, v3

    add-int/lit8 v4, v4, 0x1

    goto :goto_1

    .line 359
    :cond_2
    add-int/lit8 v3, v3, -0x1

    goto :goto_0
.end method

.method public onInterceptTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 10
    .parameter "ev"

    .prologue
    .line 149
    iget-object v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

    if-eqz v7, :cond_0

    .line 150
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v7

    packed-switch v7, :pswitch_data_0

    .line 202
    :cond_0
    :goto_0
    invoke-super {p0, p1}, Landroid/widget/ListView;->onInterceptTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v7

    :goto_1
    return v7

    .line 152
    :pswitch_0
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v7

    float-to-int v5, v7

    .line 153
    .local v5, x:I
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v7

    float-to-int v6, v7

    .line 154
    .local v6, y:I
    invoke-virtual {p0, v5, v6}, Lcom/netease/newsreader/util/DragableListView;->pointToPosition(II)I

    move-result v3

    .line 155
    .local v3, itemnum:I
    iput v3, p0, Lcom/netease/newsreader/util/DragableListView;->myItemNum:I

    .line 156
    const-string v7, "itemnum>>>"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, ">>>>>>>>"

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v8, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-static {v7, v8}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 157
    const/4 v7, -0x1

    if-eq v3, v7, :cond_0

    if-eqz v3, :cond_0

    .line 160
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v7

    sub-int v7, v3, v7

    invoke-virtual {p0, v7}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v2

    .line 161
    .local v2, itemView:Landroid/view/View;
    const/4 v1, 0x0

    .line 162
    .local v1, item:Landroid/view/ViewGroup;
    instance-of v7, v2, Landroid/widget/TextView;

    if-nez v7, :cond_0

    move-object v1, v2

    .line 165
    check-cast v1, Landroid/view/ViewGroup;

    .line 169
    const-string v7, "itemnum>>>"

    new-instance v8, Ljava/lang/StringBuilder;

    const-string v9, ">>>>>>>>"

    invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    .line 170
    const-string v9, "---"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getRawY()F

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, "----"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, "-----"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v1}, Landroid/view/ViewGroup;->getTop()I

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    .line 169
    invoke-static {v7, v8}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 171
    invoke-virtual {v1}, Landroid/view/ViewGroup;->getTop()I

    move-result v7

    sub-int v7, v6, v7

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPoint:I

    .line 172
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getRawY()F

    move-result v7

    float-to-int v7, v7

    sub-int/2addr v7, v6

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mCoordOffset:I

    .line 182
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->dragMinX:I

    if-ge v7, v5, :cond_1

    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->dragMaxX:I

    if-ge v5, v7, :cond_1

    .line 183
    const/4 v7, 0x1

    invoke-virtual {v1, v7}, Landroid/view/ViewGroup;->setDrawingCacheEnabled(Z)V

    .line 187
    invoke-virtual {v1}, Landroid/view/ViewGroup;->destroyDrawingCache()V

    .line 188
    invoke-virtual {v1}, Landroid/view/ViewGroup;->getDrawingCache()Landroid/graphics/Bitmap;

    move-result-object v7

    invoke-static {v7}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 189
    .local v0, bitmap:Landroid/graphics/Bitmap;
    invoke-direct {p0, v0, v6}, Lcom/netease/newsreader/util/DragableListView;->startDragging(Landroid/graphics/Bitmap;I)V

    .line 190
    iput v3, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    .line 191
    iget v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    .line 192
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getHeight()I

    move-result v7

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    .line 193
    iget v4, p0, Lcom/netease/newsreader/util/DragableListView;->mTouchSlop:I

    .line 194
    .local v4, touchSlop:I
    sub-int v7, v6, v4

    iget v8, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    div-int/lit8 v8, v8, 0x3

    invoke-static {v7, v8}, Ljava/lang/Math;->min(II)I

    move-result v7

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mUpperBound:I

    .line 195
    add-int v7, v6, v4

    iget v8, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    mul-int/lit8 v8, v8, 0x2

    div-int/lit8 v8, v8, 0x3

    invoke-static {v7, v8}, Ljava/lang/Math;->max(II)I

    move-result v7

    iput v7, p0, Lcom/netease/newsreader/util/DragableListView;->mLowerBound:I

    .line 196
    const/4 v7, 0x0

    goto/16 :goto_1

    .line 198
    .end local v0           #bitmap:Landroid/graphics/Bitmap;
    .end local v4           #touchSlop:I
    :cond_1
    const/4 v7, 0x0

    iput-object v7, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    goto/16 :goto_0

    .line 150
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
    .end packed-switch
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 14
    .parameter "ev"

    .prologue
    const/4 v13, 0x0

    .line 72
    iget-object v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

    if-eqz v11, :cond_8

    iget-object v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    if-eqz v11, :cond_8

    .line 73
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    .line 74
    .local v0, action:I
    packed-switch v0, :pswitch_data_0

    .line 139
    :cond_0
    :goto_0
    const/4 v11, 0x1

    .line 141
    .end local v0           #action:I
    :goto_1
    return v11

    .line 77
    .restart local v0       #action:I
    :pswitch_0
    iget-object v3, p0, Lcom/netease/newsreader/util/DragableListView;->mTempRect:Landroid/graphics/Rect;

    .line 78
    .local v3, r:Landroid/graphics/Rect;
    iget-object v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDragView:Landroid/widget/ImageView;

    invoke-virtual {v11, v3}, Landroid/widget/ImageView;->getDrawingRect(Landroid/graphics/Rect;)V

    .line 79
    invoke-direct {p0}, Lcom/netease/newsreader/util/DragableListView;->stopDragging()V

    .line 80
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v11

    float-to-int v8, v11

    .line 81
    .local v8, xx:I
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v11

    float-to-int v10, v11

    .line 82
    .local v10, yy:I
    iput v8, p0, Lcom/netease/newsreader/util/DragableListView;->xValue:I

    .line 83
    iput v10, p0, Lcom/netease/newsreader/util/DragableListView;->yValue:I

    .line 84
    iget-object v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

    if-eqz v11, :cond_0

    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    if-ltz v11, :cond_0

    .line 85
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getCount()I

    move-result v12

    if-gt v11, v12, :cond_0

    .line 86
    iget-object v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

    iget v12, p0, Lcom/netease/newsreader/util/DragableListView;->mFirstDragPos:I

    iget v13, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    invoke-interface {v11, v12, v13}, Lcom/netease/newsreader/util/DragableListView$DropListener;->drop(II)V

    goto :goto_0

    .line 93
    .end local v3           #r:Landroid/graphics/Rect;
    .end local v8           #xx:I
    .end local v10           #yy:I
    :pswitch_1
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v11

    float-to-int v7, v11

    .line 94
    .local v7, x:I
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v11

    float-to-int v9, v11

    .line 95
    .local v9, y:I
    invoke-direct {p0, v7, v9}, Lcom/netease/newsreader/util/DragableListView;->dragView(II)V

    .line 98
    invoke-virtual {p0, v7, v9}, Lcom/netease/newsreader/util/DragableListView;->myPointToPosition(II)I

    move-result v1

    .line 100
    .local v1, itemnum:I
    if-ltz v1, :cond_0

    .line 101
    if-eqz v0, :cond_1

    .line 102
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    if-eq v1, v11, :cond_2

    .line 104
    :cond_1
    iput v1, p0, Lcom/netease/newsreader/util/DragableListView;->mDragPos:I

    .line 111
    :cond_2
    const/4 v5, 0x0

    .line 112
    .local v5, speed:I
    invoke-direct {p0, v9}, Lcom/netease/newsreader/util/DragableListView;->adjustScrollBounds(I)V

    .line 113
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mLowerBound:I

    if-le v9, v11, :cond_6

    .line 115
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    iget v12, p0, Lcom/netease/newsreader/util/DragableListView;->mLowerBound:I

    add-int/2addr v11, v12

    div-int/lit8 v11, v11, 0x2

    if-le v9, v11, :cond_5

    const/16 v5, 0x10

    .line 120
    :cond_3
    :goto_2
    if-eqz v5, :cond_0

    .line 121
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    div-int/lit8 v11, v11, 0x2

    invoke-virtual {p0, v13, v11}, Lcom/netease/newsreader/util/DragableListView;->pointToPosition(II)I

    move-result v4

    .line 122
    .local v4, ref:I
    const/4 v11, -0x1

    if-ne v4, v11, :cond_4

    .line 125
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mHeight:I

    div-int/lit8 v11, v11, 0x2

    .line 126
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getDividerHeight()I

    move-result v12

    add-int/2addr v11, v12

    add-int/lit8 v11, v11, 0x40

    .line 125
    invoke-virtual {p0, v13, v11}, Lcom/netease/newsreader/util/DragableListView;->pointToPosition(II)I

    move-result v4

    .line 128
    :cond_4
    invoke-virtual {p0}, Lcom/netease/newsreader/util/DragableListView;->getFirstVisiblePosition()I

    move-result v11

    sub-int v11, v4, v11

    invoke-virtual {p0, v11}, Lcom/netease/newsreader/util/DragableListView;->getChildAt(I)Landroid/view/View;

    move-result-object v6

    .line 129
    .local v6, v:Landroid/view/View;
    if-eqz v6, :cond_0

    .line 130
    invoke-virtual {v6}, Landroid/view/View;->getTop()I

    move-result v2

    .line 131
    .local v2, pos:I
    sub-int v11, v2, v5

    invoke-virtual {p0, v4, v11}, Lcom/netease/newsreader/util/DragableListView;->setSelectionFromTop(II)V

    goto/16 :goto_0

    .line 115
    .end local v2           #pos:I
    .end local v4           #ref:I
    .end local v6           #v:Landroid/view/View;
    :cond_5
    const/4 v5, 0x4

    goto :goto_2

    .line 116
    :cond_6
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mUpperBound:I

    if-ge v9, v11, :cond_3

    .line 118
    iget v11, p0, Lcom/netease/newsreader/util/DragableListView;->mUpperBound:I

    div-int/lit8 v11, v11, 0x2

    if-ge v9, v11, :cond_7

    const/16 v5, -0x10

    :goto_3
    goto :goto_2

    :cond_7
    const/4 v5, -0x4

    goto :goto_3

    .line 141
    .end local v0           #action:I
    .end local v1           #itemnum:I
    .end local v5           #speed:I
    .end local v7           #x:I
    .end local v9           #y:I
    :cond_8
    invoke-super {p0, p1}, Landroid/widget/ListView;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v11

    goto/16 :goto_1

    .line 74
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_0
        :pswitch_1
        :pswitch_0
    .end packed-switch
.end method

.method public setDropListener(Lcom/netease/newsreader/util/DragableListView$DropListener;)V
    .locals 0
    .parameter "onDrop"

    .prologue
    .line 377
    iput-object p1, p0, Lcom/netease/newsreader/util/DragableListView;->mDropListener:Lcom/netease/newsreader/util/DragableListView$DropListener;

    .line 378
    return-void
.end method
